package cn.wit.test;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;

public class DemoExecutor {
	public static void main(String[] args) {
		//线程的执行服务，创建了一个具有三个线程的线程池，最多三个线程
		ExecutorService service = Executors.newFixedThreadPool(3);
		
		service.execute(new ExecutorRunnable(8));
		service.execute(new ExecutorRunnable(9));
		service.execute(new ExecutorRunnable(10));
	}

}
class ExecutorRunnable implements Runnable{

	private int num;
	
	public ExecutorRunnable(int num) {
		// TODO Auto-generated constructor stub
		this.num = num;
	}
	
	@Override
	public void run() {
		// TODO Auto-generated method stub
		while(true) {
			System.out.println(num);
		}
		
	}
	
}
